package com.lei.oss.controller;

import com.lei.oss.service.OssService;
import com.lei.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * Created by IntelliJ
 * Author:熊磊
 */
@RestController
@RequestMapping("edu/oss")
public class OssController {
    @Autowired
    private OssService ossService;

    //上传头像
    @PostMapping("")
    public Result uploadOssFile(MultipartFile file){

        String url = ossService.uploadFileAvatar(file);
        if (url!=null){
            return Result.ok().data("url",url);
        }
        return Result.error();
    }
}
